<?php

use Illuminate\Http\Request;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

//Route::middleware('auth:api')->get('/user', function (Request $request) {
//    return $request->user();
//});

// 接口登录api 路由
Route::post('login', 'Api\LoginController@login');

// 请求验证
Route::group(['middleware' => 'auth:api', 'prefix' => 'v1', 'namespace' => 'Api'], function () {
    Route::get('users', function () {
        return 123456;
    });
    // 微信小程序登录
    Route::post('wxlogin', 'LoginController@wxlogin');
    // 微信小程序获取用户信息
    Route::get('user/userinfo', 'UserController@getuserinfo');
    // 保存用户信息
    Route::post('user/userinfo', 'UserController@userinfo');
    // 图片保存
    Route::post('user/upfile', 'UserController@upfile');
    // 预约信息  notice
    Route::get('notices', 'NoticeController@getinfo');
    // 房源资讯列表
    Route::get('news', 'NewsController@getlist');
    // 房源文章阅读人数统计
    Route::post('news/{article}', 'NewsController@count');
    // 房源资讯详情
    Route::any('news/{article}', 'NewsController@show');
    // 推荐房源
    Route::get('fang/tuijian', 'FangController@tuijian');
    // 获取租房小组
    Route::get('fang/group', 'FangController@group');
    // 获取房源
    Route::get('fang/index', 'FangController@index');
    // 获取单个房源
    Route::get('fang/index/{fang}', 'FangController@getinfo');
    // 添加收藏  房源
    Route::post('fang/fav', 'FangController@fav');
    // 获取房源属性
    Route::get('fangattrs', 'FangattrController@attr');
    // ES搜索
    Route::get('esfang', 'FangController@esfang');
});
